#include <src/test/math/Operators/GenericAlgebra_test.h>

void GenericAlgebra_test() {
std::cout << std::endl << "----Start GenericAlgebra_test---------------------" << std::endl ;

		double_function<double,double> double_function_ ;
		double_function<double,double> equality_test;
		equality_test = double_function_;
		OS_DYNAMIC_CHECK( (equality_test == double_function_), "OS_Generic_Algebra : double_function_.id == 3 failed");
		{
			double_function_ = x_3_function<double,double>();
		};
		std::cout << double_function_;
		std::cout << "-------------" << std::endl;
		OS_DYNAMIC_CHECK(double_function_.get_name() == equality_test.get_name(), "OS_Generic_Algebra : double_function_.id == 3 failed");
		{
			x_3_function<double,double> x_3_function_;
			x_2_function<double,double> x_2_function_;
			double_function_ = x_3_function_ + x_2_function_;
		};
		std::cout << double_function_;
		std::cout << "-------------" << std::endl;
		double result = double_function_(2);
		OS_DYNAMIC_CHECK(result == 12, "OS_Generic_Algebra : test result = 12 failed");

		{
			x_3_function<double,double> x_3_function_;
			x_2_function<double,double> x_2_function_;
			double_function_ = x_3_function_ - x_2_function_;
		};
		std::cout << double_function_;
		std::cout << "-------------" << std::endl;
		result = double_function_(2);
		OS_DYNAMIC_CHECK(result == 4, "OS_Generic_Algebra : test result = 4 failed");
		{
			x_3_function<double,double> x_3_function_;
			x_2_function<double,double> x_2_function_;
			double_function_ = x_3_function_ * x_2_function_;
		};
		std::cout << double_function_;
		std::cout << "-------------" << std::endl;
		result = double_function_(2);
		OS_DYNAMIC_CHECK(result == 32, "OS_Generic_Algebra : test result = 32 failed");
		{
			x_3_function<double,double> x_3_function_;
			x_2_function<double,double> x_2_function_;
			double_function_ = x_3_function_ / x_2_function_;
		};
		std::cout << double_function_;
		std::cout << "-------------" << std::endl;
		result = double_function_(2);
		OS_DYNAMIC_CHECK(result == 2, "OS_Generic_Algebra : test result = 32 failed");
		{
			x_3_function<double,double> x_3_function_;
			x_2_function<double,double> x_2_function_;
			double_function_ = 3.* (x_3_function_/4. + 2.* x_2_function_);
		};
		std::cout << double_function_;
		std::cout << "-------------" << std::endl;
		result = double_function_(2);
		OS_DYNAMIC_CHECK(result == 30, "OS_Generic_Algebra : result = 30 failed");
		equality_test = double_function_;
		std::cout << equality_test<<std::endl;
		result = equality_test(2);
		OS_DYNAMIC_CHECK(result == 30, "OS_Generic_Algebra : result = 30(2) failed");
		typedef double_function<double,double>::Base Base;
		OS_DYNAMIC_CHECK(double_function_ == equality_test, "OS_Generic_Algebra : test double_function_ == equality_test failed");
		OS_DYNAMIC_CHECK((Base &) double_function_ == (Base &) equality_test, "OS_Generic_Algebra : test double_function_ == equality_test failed");

std::cout << std::endl << "----End GenericAlgebra_test---------------------" << std::endl ;

};
